package org.sepheriel.airy2d.tiles;

import org.sepheriel.airy2d.math.Vec2;

/**
 * This Class represents a Tile of a Tile World.
 * @author Sepheriel - Sascha Fitz
 */
public class Tile {
	
	private Vec2 pos;
	int kind;
	private boolean walkable;
	private int texID;
	private int size;

	/**
	 * Tile Construct0r
	 * @param k is the Tile kind for Example Stone or a Ladder or whatever,
	 * this is be needed for the layers
	 */
	Tile(int k) {
		pos = new Vec2();
		setKind(k);
		size = 64;
	}

	/**
	 * @return the position Vec2 of the Tile (the upper left corner)
	 */
	public Vec2 getPos() {
		return pos;
	}

	/**
	 * @return the position Vec2 of the middle of the Tile
	 */
	public Vec2 getMid() {
		return new Vec2(pos.getX()+size/2, pos.getY()+size/2);
	}
	
	/**
	 * Sets the position Vec2 (upper left corner) of the Tile
	 * @param pos is the position Vec2 of the Tile ( upper left corner)
	 */
	public void setPos(Vec2 _pos) {
		pos = _pos;
	}
	
	/**
	 * @param _pos
	 */
	public void calcPos(Vec2 _pos) {
		this.pos = new Vec2(_pos.getX()*size, _pos.getY()*size);
	}

	/**
	 * @return the kind of the Tile
	 */
	public int getKind() {
		return kind;
	}

	/**
	 * Sets the kind of the Tile
	 * @param kind the kind of the Tile
	 */
	public void setKind(int kind) {
		this.kind = kind;
	}
}
